//
//  YHYDemoViewController.swift
//  微博(学习)
//
//  Created by yhy on 16/9/2.
//  Copyright © 2016年 yhy. All rights reserved.
//

import UIKit

class YHYDemoViewController: YHYBaseViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        //设置标题
        title = "第\(navigationController?.childViewControllers.count ?? 0)个"
    }
    
    // MARK: - 监听方法
    //继续 push 一个新的控制器
    @objc fileprivate func showNext() {
        let vc = YHYDemoViewController()
        
        navigationController?.pushViewController(vc, animated: true)
    }

}

extension YHYDemoViewController {
    
    //重写父类方法
    override func setupTableView() {
        super.setupTableView()
        // 设置右侧的控制器
        //navigationItem.rightBarButtonItem = UIBarButtonItem(title: "下一个", style: .Plain, target: self, action: #selector(showNext))
//        let btn: UIButton = UIButton.cz_textButton("下一个", fontSize: 16, normalColor: UIColor.darkGrayColor(), highlightedColor: UIColor.orangeColor())
//        btn.addTarget(self, action: #selector(showNext), forControlEvents: .TouchUpInside)
//        
//        navigationItem.rightBarButtonItem = UIBarButtonItem(customView: btn)
        navItem.rightBarButtonItem = UIBarButtonItem(title: "下一个", target: self, action: #selector(showNext))
    }
}
